#include<iostream>
using namespace std;
const int N = 1e3 + 10;
int arr[N];
int main()
{
	int t = 0;
	cin >> t;
	while (t--) {
		int n;
		cin >> n;
		int max = -1;
		long long mul = 1;
		for (int i = 0; i < n; i++) {
			cin >> arr[i];
			if (arr[i] > max) {
				max = arr[i];
			}
			mul *= arr[i];
		}
		long long ret = 0;
		long long i = 0;
		for (i = max; i <= mul; i++) {
			bool flag = true;
			for (int j = 0; j < n; j++) {
				if (i % arr[j] != 0) {
					flag = false;
					break;
				}
			}
			if (flag) {
				ret = i;
				break;
			}
		}
		cout << ret << endl;
	}
	return 0;
}